make OUTPUT subdirs
authorJoey Hess <joeyh@joeyh.name>
Fri, 7 Mar 2025 18:57:12 +0000 (14:57 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 7 Mar 2025 18:57:12 +0000 (14:57 -0400)
Simplifies compute programs.

Remote/Compute.hs
doc/design/compute_special_remote_interface.mdwn
doc/special_remotes/compute/git-annex-compute-imageconvert

index d4bcd3359ae1843aafc0eb71faf9bb775a0e3680..c41c1b91dcbb23aac522f82dc781dc52c8a728e5 100644 (file)
@@ -476,6 +476,11 @@ runComputeProgram (ComputeProgram program) state (ImmutableState immutablestate)
                        liftIO $ hPutStrLn (stdinHandle p) $
                                toCommand' (File f)
                        liftIO $ hFlush (stdinHandle p)
+                       -- If the output file is in a subdirectory, make
+                       -- the directories so the compute program doesn't
+                       -- need to.
+                       liftIO $ createDirectoryIfMissing True $ 
+                               takeDirectory (subdir </> f')
                        knownoutput <- case M.lookup f' (computeOutputs $ computeState result) of
                                Nothing -> return False
                                Just mk -> do
index 5a55e2fe2c7049a1326f573d90c9e3d05a89e2a9..93da38147b12df25d5c90cea71c7127ce30302ab 100644 (file)
@@ -110,6 +110,5 @@ An example `git-annex-compute-foo` shell script follows:
     echo REPRODUCIBLE
 
     if [ -n "$input" ]; then
-        mkdir -p "$(dirname "$output")"
         frobnicate --passes="$ANNEX_COMPUTE_passes" <"$input" >"$output"
     fi
index 16eb14da07a06ddfb38bb0a5a0406bee7a343b9c..3ecd4c0790e7a5164f7a2b0ce144888829ef928d 100755 (executable)
@@ -17,6 +17,5 @@ echo "OUTPUT $2"
 read output
 
 if [ -n "$input" ]; then
-       mkdir -p "$(dirname "$output")"
        convert "$input" "$output"
 fi